<?php 
/**
 * File: View - Sites - index.phtml
 */
 
 	$this->jQuery()->addJavascriptFile( $this->layout_base . '/third/js/modules/sites.js');

?>
			<div class="page-title ui-widget-content ui-corner-all">
				<div>
						<div class="float-left">
							<br />
							<h1>Editar <?php echo $this->moduleTitle ?></h1>
						</div>
						<div class="button float-right">
							<a href="/third/sites"  class="btn ui-state-default"><span class="ui-icon ui-icon-circle-triangle-w"></span>Voltar para listagem</a>
						</div>
						<div class="clearfix"></div>
				</div>
				<div id="main-itens-content" class="other" >
					<?php echo($this->flashMessages()); ?>

					<div class="cont ui-corner-all yellow-box ">
						Editando site: <strong><?php echo $this->site['titulo'] ?></strong>
					</div>
					<Br />
					<div class="two-column">
					
						<!-- DADOS -->
						<div  class="column">
							<div class="portlet">
								<div class="portlet-header">Dados</div>
								<div class="portlet-content">
										<?php 
											if( $this->formErro ){
												echo "<div class='response-msg error ui-corner-all'>".$this->formErro."</div>"; 
											}
										?>
										<?php echo $this->form; ?>
								</div>
							</div>
							
							<!--  PRIVILEGIOS -->
							<div  class="column column-big">
								<div class="portlet">
									<div class="portlet-header">Privil&eacute;gios do grupo</div>
									<div class="portlet-content">
									<!-- PRIVILEGIOS -->
										<div id="privilegios_container"></div>
										<form action="/third/sites/privilegios" method="post" id="privilegios_form_container" name="privilegios_form_container">
											<input type="submit" value="Salvar" />
													<?php echo $this->action('privileges-fields', 'grupos', 'third', array('privileges'=>$this->privileges) ) ?>
											<input type="hidden" name="id" value="<?php echo $this->site['id'] ?>" /><br /><input type="submit" value="Salvar" />
											<div class="clearfix"></div>
										</form>
									</div>
									<!-- PRIVILEGIOS -->
								</div>	
							</div>
							<!--  PRIVILEGIOS END -->	
							
							
						</div>
						
						<!-- ACOES -->
						<div  class="column">
							<div class="portlet">
								<div class="portlet-header">A&ccedil;&otilde;es</div>
								<div class="portlet-content">
									<ul>
										<li><a href="<?php echo $this->mainLink ?>"  target="_blank" class="btn ui-state-default"><span class="ui-icon ui-icon-search"></span>Visualizar</a></li>
										<?php if( $this->site['status'] == "1" ){ ?>
											<li><a href="/third/sites/unlock/id/<?php echo $this->site['id'] ?>" class="btn ui-state-default"><span class="ui-icon ui-icon-locked"></span>Bloquear site</a></li>
										<?php } else if( $this->site['status'] == "0" ) { ?>
											<li><a href="/third/sites/unlock/id/<?php echo $this->site['id'] ?>" class="btn ui-state-default"><span class="ui-icon ui-icon-unlocked"></span>Liberar site</a></li>	
										<?php } ?>
										<li><a href="/third/sites/delete/id/<?php echo $this->site['id'] ?>" class="btn ui-state-default"><span class="ui-icon ui-icon-minus"></span>Remover site</a></li>
									</ul>
								</div>
							</div>	
						</div>
						<!-- ACOES END -->

						<!-- USUARIOS -->
						<div  class="column">
							<div class="portlet">
								<div class="portlet-header">Usu&aacute;rios</div>
								<div class="portlet-content">
									<div class="button float-right">
										<a href="/third/sites/adicionar-usuario-ao-site/tipo/<?php echo $this->site['profile'] ?>/site/<?php echo $this->site['id'] ?>"  class="btn ui-state-default" id="adicionarUsuarioAoSite"><span class="ui-icon ui-icon-person"></span>Adicionar usu&aacute;rio</a>
									</div>
									<div id="adicionarUsuarioAoSiteContainer"></div>
									
									<div class="listContainer page-title ui-corner-all">
										<h1>Usuarios do site</h1>
										<ul  class="list" id="usuariosDoSite">
										<?php 
											if( $this->usuarios ){
												foreach( $this->usuarios as $user ){
													echo "<li>".$user['nome']."
														<div class='button float-right'>
															<a href='/third/sites/adicionar-usuario-ao-site/id/".$user['id']."/ac/excluir/site/".$this->site['id']."'  class='btn ui-state-default'>
															<span class='ui-icon ui-icon-minus'></span>excluir</a>
														</div>
														<div class='clearfix' />
													</li>";
												}											
											} else {
													echo "<li class='empty'>Sem usu&aacute;rios neste site</li>";
											}
										?>
										</ul>
									</div>
								</div>
							</div>	
						</div>
						<!-- USUARIOS END -->						

						
					</div>

				</div>
					
				<div class="clearfix"></div>
			</div>
